package stream.demo01;

import java.util.ArrayList;

//Stream流,初体验
public class StreramDemo01 {

    public static void main(String[] args) {

        //创建一个集合
        ArrayList<String> arrayList = new ArrayList<>();

        //添加元素
        arrayList.add("234");
        arrayList.add("2334");
        arrayList.add("2312");
        arrayList.add("43412");

        //Stream流操作
        arrayList.stream().filter(s -> s.startsWith("2")).filter(s -> s.length() == 4).forEach(s -> System.out.println(s));

    }
}
